package main

import (
    "crypto/elliptic"
    "crypto/rand"
    "fmt"
)

// 椭圆曲线加密
func main() {
    curve := elliptic.P224()

    Apriv, Ax, Ay, err := elliptic.GenerateKey(curve, rand.Reader)
    if err != nil {
        panic(err)
    }

    Bpriv, Bx, By, err := elliptic.GenerateKey(curve, rand.Reader)
    if err != nil {
        panic(err)
    }

    s1, _ := curve.ScalarMult(Bx, By, Apriv)
    fmt.Println(s1.Text(16))

    s2, _ := curve.ScalarMult(Ax, Ay, Bpriv)
    fmt.Println(s2.Text(16))
}

// https://www.jianshu.com/p/6de5da5f04c9/
